package com.example.taxfloatproject20240926.ui.room;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.taxfloatproject20240926.ui.bean.CallBean;


@Database(entities = {CallBean.class},version = 1,exportSchema = false)
public abstract class AppDataBase extends RoomDatabase {
    public static volatile AppDataBase sInstance;
    public abstract CallDao callDao();

    public static AppDataBase getInstance(Context context){
        if (sInstance == null){
            synchronized (AppDataBase.class){
                if (sInstance == null) {
                    sInstance =
                            Room.databaseBuilder(context,AppDataBase.class,"call.db").fallbackToDestructiveMigration().build();
                }
            }
        }
        return sInstance;
    }

}
